package com.ruoyi.business.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.HurtPatientReportMapper;
import com.ruoyi.business.domain.HurtPatientReport;
import com.ruoyi.business.service.IHurtPatientReportService;

/**
 * 患者上传报告Service业务层处理
 *
 * @author ruoyi
 * @date 2024-04-17
 */
@Service
public class HurtPatientReportServiceImpl implements IHurtPatientReportService
{
    @Autowired
    private HurtPatientReportMapper hurtPatientReportMapper;

    /**
     * 查询患者上传报告
     *
     * @param id 患者上传报告主键
     * @return 患者上传报告
     */
    @Override
    public HurtPatientReport selectHurtPatientReportById(Long id)
    {
        return hurtPatientReportMapper.selectHurtPatientReportById(id);
    }

    /**
     * 查询患者上传报告列表
     *
     * @param hurtPatientReport 患者上传报告
     * @return 患者上传报告
     */
    @Override
    public List<HurtPatientReport> selectHurtPatientReportList(HurtPatientReport hurtPatientReport)
    {
        return hurtPatientReportMapper.selectHurtPatientReportList(hurtPatientReport);
    }

    /**
     * 新增患者上传报告
     *
     * @param hurtPatientReport 患者上传报告
     * @return 结果
     */
    @Override
    public int insertHurtPatientReport(HurtPatientReport hurtPatientReport)
    {
        return hurtPatientReportMapper.insertHurtPatientReport(hurtPatientReport);
    }

    /**
     * 修改患者上传报告
     *
     * @param hurtPatientReport 患者上传报告
     * @return 结果
     */
    @Override
    public int updateHurtPatientReport(HurtPatientReport hurtPatientReport)
    {
        return hurtPatientReportMapper.updateHurtPatientReport(hurtPatientReport);
    }

    /**
     * 批量删除患者上传报告
     *
     * @param ids 需要删除的患者上传报告主键
     * @return 结果
     */
    @Override
    public int deleteHurtPatientReportByIds(Long[] ids)
    {
        return hurtPatientReportMapper.deleteHurtPatientReportByIds(ids);
    }

    /**
     * 删除患者上传报告信息
     *
     * @param id 患者上传报告主键
     * @return 结果
     */
    @Override
    public int deleteHurtPatientReportById(Long id)
    {
        return hurtPatientReportMapper.deleteHurtPatientReportById(id);
    }

    @Override
    public boolean uploadPatientReport(HurtPatientReport hurtPatientReport) {
        hurtPatientReport.setCreateTime(DateUtils.getNowDate());
        return hurtPatientReportMapper.insertHurtPatientReport(hurtPatientReport) > 0;
    }

    @Override
    public List<Map<String,Object>> getHistoryReport(Long patientId) {
        return hurtPatientReportMapper.getHistoryReport(patientId);
    }
}
